import request from "@/utils/request";

// 查询EduCourse列表
export function listEduCourse(query) {
    return request({
        url: "/api/v1/serviceList",
        method: "get",
        params: query
    });
}

// 查询EduCourse详细
export function getEduCourse(serviceId) {
    return request({
        url: "/api/v1/service/" + serviceId,
        method: "get"
    });
}

// 新增EduCourse
export function addEduCourse(data) {
    let url = "/api/v1/service";
    return request({
        url,
        method: "post",
        data: data
    });
}

// 修改EduCourse
export function updateEduCourse(data) {
    let url = "/api/v1/service";
    return request({
        url,
        method: "put",
        data: data
    });
}

// 删除EduCourse
export function delEduCourse(serviceId) {
    return request({
        url: "/api/v1/service/" + serviceId,
        method: "delete"
    });

}

// 修改章/节
export function putChapter(serviceId, data) {
    return request({
        url: `/api/v1/serviceInfo/${serviceId}/chapter`,
        method: "put",
        data
    });
}

// 新增章/节
export function postChapter(serviceId, data) {
    return request({
        url: `/api/v1/serviceInfo/${serviceId}/chapter`,
        method: "post",
        data
    });
}

// 设置章节排序
export function postSort(serviceId, data) {
    return request({
        url: `/api/v1/serviceInfo/${serviceId}/chapter/sort`,
        method: "post",
        data
    });
}

// 删除章/节
export function delChapter(serviceId, chapterId) {
    return request({
        url: `/api/v1/serviceInfo/${serviceId}/chapter/${chapterId}`,
        method: "delete"
    });
}

// 课时列表
export function chapterList(serviceId, params) {
    return request({
        url: `/api/v1/serviceInfo/${serviceId}/chapterList`,
        method: "get",
        params
    });
}

// 添加课时
export function postLesson(serviceId, data) {
    return request({
        url: `/api/v1/serviceInfo/${serviceId}/lesson`,
        method: "post",
        data
    });
}

// 添加课时
export function postLessonBatch(serviceId, data) {
    return request({
        url: `/api/v1/serviceInfo/${serviceId}/lesson/batch`,
        method: "post",
        data
    });
}

// 查询课时详情
export function getLesson(serviceId, chapterId) {
    return request({
        url: `/api/v1/serviceInfo/${serviceId}/lesson/${chapterId}`,
        method: "get"
    });
}

// 修改课时
export function putLesson(serviceId, data) {
    return request({
        url: `/api/v1/serviceInfo/${serviceId}/lesson`,
        method: "put",
        data
    });
}

// 修批量改课时
export function putLessonBatch(serviceId, data) {
    return request({
        url: `/api/v1/serviceInfo/${serviceId}/lesson/batch`,
        method: "put",
        data
    });
}

// 课时列表
export function lessonList(serviceId) {
    return request({
        url: `/api/v1/serviceInfo/${serviceId}/lessonList`,
        method: "get"
    });
}

// 添加课程老师
export function postTeacher(serviceId, data, type = "courseInfo") {
    return request({
        url: `/api/v1/edu/${type}/${serviceId}/teacher`,
        method: "post",
        data
    });
}

// 删除课程老师
export function delTeacher(serviceId, courseTeacherId) {
    return request({
        url: `/api/v1/serviceInfo/${serviceId}/teacher/${courseTeacherId}`,
        method: "delete"
    });
}

// 课程学员列表
export function teacherList(serviceId, type = "courseInfo", params) {
    return request({
        url: `/api/v1/edu/${type}/${serviceId}/teacherList`,
        method: "get",
        params
    });
}

// 修改课程或者班级学员的备注
// 班级    ClassroomInfo
// 课程    courseInfo
export function editStudent(serviceId, data, type = "courseInfo") {
    return request({
        url: `/api/v1/edu/${type}/${serviceId}/student/remark`,
        method: "put",
        data
    });
}

// 删除课程学员 || 删除班级学员
export function delStudent(serviceId, courseStudentId, type = "courseInfo") {
    return request({
        url: `/api/v1/edu/${type}/${serviceId}/student/${courseStudentId}`,
        method: "delete"
    });
}

// 课程老师列表 || 班级学员列表
export function studentList(serviceId, type = "courseInfo", params) {
    return request({
        url: `/api/v1/edu/${type}/${serviceId}/studentList`,
        method: "get",
        params
    });
}
